#pragma once
#include <list>
#include <map>
#include "Singleton.h"
#import <msxml6.dll>
#include <MsXml.h>

class EditorItem;
class ICatalogVisitor;

class CEditorConfig : 
	public ATools::TSingleton<CEditorConfig>
{
public:
	enum EDITOR_CATALOG
	{
		EC_CAMERA,
		EC_STDVIEW,
		EC_SKETCH,
		EC_FEATURE,
		EC_PRIMIVE,
		EC_OTHER
	};
	CEditorConfig(void);
	~CEditorConfig(void);
	bool Load(LPTSTR szPathFile);
	void VisitCatalog(EDITOR_CATALOG catalog, ICatalogVisitor* pVisitor);

private:
	bool ParseCatalog(const MSXML2::IXMLDOMNodePtr& pCatalogNode);
private:
	typedef std::list<EditorItem*> EditorList;
	typedef std::map<EDITOR_CATALOG, EditorList*> EditorCatalog;
	
	EditorCatalog m_Catalog;

	typedef std::map<CString, EDITOR_CATALOG> CatalogIDMap;
	CatalogIDMap  m_mapCatalogID;

	CImageList m_imageList;

};

inline CEditorConfig& GetEditorConfig()
{
	return CEditorConfig::Instance();
}
//////////////////////////////////////////////////////////////////////////

class EditorItem
{
public:
	EditorItem()
	{
		hIcon = NULL;
	}
	CString szName;
	CString guid;
	CString szToolTip;
	CString szProperty;
	HICON	hIcon;
};

//////////////////////////////////////////////////////////////////////////

class ICatalogVisitor
{
public:
	virtual ~ICatalogVisitor(){}
	virtual void OnVisitItem(EditorItem* pItem) = 0;
};